package com.zb.spring5.aop.dynamic;

import com.zb.spring5.enums.Operation;
import com.zb.spring5.enums.Planet;
import net.mindview.util.Range;
import org.springframework.aop.Advisor;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.DefaultPointcutAdvisor;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.SignStyle;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.util.Arrays;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.atomic.AtomicReference;

public class DynamicPointDemo {

    public static void main(String[] args) {
//        SampleBean target = new SampleBean();
//
//        Advisor advisor = new DefaultPointcutAdvisor(new SimpleDynamicPointcut(), new SimpleAdvice());
//
//        ProxyFactory pf = new ProxyFactory();
//        pf.setTarget(target);
//        pf.addAdvisor(advisor);
//
//        SampleBean proxy = (SampleBean)pf.getProxy();
//
//        proxy.foo(100);
//        proxy.foo(5);
//        proxy.foo(100);
        Optional<Operation> operation = Operation.fromString("-");

        System.out.println(operation.get());
        System.out.println(Operation.valueOf("PLUS"));

//        proxy.bar();
//        proxy.bar();
//        proxy.bar();
//        AtomicReference<BigDecimal> shouldPayTotal = new AtomicReference<>(BigDecimal.valueOf(1));
//        AtomicReference<BigDecimal> shouldPayTotal1 = new AtomicReference<>(BigDecimal.valueOf(2));
//        shouldPayTotal.set(shouldPayTotal.get().add(shouldPayTotal1.get()));
//        System.out.println(shouldPayTotal.get());
//        System.out.println(target.getCharge());
//        boolean equals = Boolean.FALSE.equals(target.getCharge());
//        System.out.println(equals);
    }
}
